package org.ring.jb.file;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileGenerator {

	public void generate(File file, long size) {
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(file);
			long times = size / 4096;
			byte[] b = new byte[4096];

			while (times-- > 0) {
				fos.write(b);
				fos.flush();
			}
			fos.close();

		} catch (FileNotFoundException fnfe) {
			fnfe.printStackTrace();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		} finally {
			fos = null;
		}
	}
}
